package com.example;

import org.apache.ibatis.session.SqlSession;
import public_util.model.*;
import system_api_4_trade.SpecialApplicationAfter;
import system_api_4_trade.dao.ApiPublicMiddleTableMapper;
import system_api_4_trade.util.AfterTool;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;

/**
 * 新系统将API扩展成Before和After方法，这里是After方法完成相关的操作
 */
public class SpecialApplicationAfter4Example extends SpecialApplicationAfter {


    @Override
    public ReturnData public_page_4m_login_data_admin(SqlSession session, PublicDataAdminUser adminUser, HttpServletRequest request, HashMap<String, Object> param2db, ReturnData data) {

        ApiPublicMiddleTableMapper middleTableMapper = session.getMapper(ApiPublicMiddleTableMapper.class);

        //角色的作用, 在此处组装
        tutorial.lite_mod.admin_power.TemplateUtilApi.pre_cmd_para_show_admin_tree(adminUser, request, session, param2db, data);
        return null;
    }


    @Override
    public ReturnData public_load_middle_table_list(HttpServletRequest request, ReturnData last_return, SqlSession session, HashMap<String, Object> param2db, List<PublicMiddleTable> tbList) {

        if (tbList != null && tbList.size() != 0) {
            tutorial.lite_mod.schedule_system.TemplateUtilApi.pre_cmd_para_show_append_info(tbList,request, session, param2db, last_return);

            tutorial.lite_mod.forum_bbs.TemplateUtilApi.pre_cmd_para_show_main_info(tbList,request, session, param2db, last_return);
            tutorial.lite_mod.forum_bbs.TemplateUtilApi.pre_cmd_para_show_answer_info(tbList,request, session, param2db, last_return);
            tutorial.lite_mod.vote_tool.TemplateUtilApi.pre_cmd_para_show_option_data(tbList,request, session, param2db, last_return);
            tutorial.lite_mod.vote_tool.TemplateUtilApi.pre_cmd_para_show_user_data(tbList,request, session, param2db, last_return);

        } else {
            return null;
        }
        return null;
    }


    @Override
    public ReturnData public_insert_or_update_middle_table(String pre_db_para_id_public_middle_table, HttpServletRequest request, ReturnData last_return, SqlSession session, HashMap<String, Object> param2db) {

        if (pre_db_para_id_public_middle_table == null) {
            tutorial.lite_mod.chat_content.TemplateUtilApi.pre_cmd_para_auto_answer(request, session, param2db, last_return);
        }

        return null;
    }

    @Override
    public ReturnData public_page_4m_load_agent_list(HttpServletRequest request, ReturnData last_return, SqlSession session, List<PublicAgentInfo> agentList, HashMap<String, Object> param2db) {

        if (agentList != null && agentList.size() != 0) {
            tutorial.lite_mod.human_res.TemplateUtilApi.pre_cmd_para_show_human_res_agent_info(agentList,request, session, param2db, last_return);
            tutorial.lite_mod.comment_sth.TemplateUtilApi.pre_cmd_para_show_score_agent_info(agentList,request, session, param2db, last_return);
        } else {
            return null;
        }
        return null;
    }


    @Override
    public ReturnData public_page_4m_load_user_list(HttpServletRequest request, SqlSession session, List<PublicUserInfo> publicUserInfo_list, HashMap<String, Object> params2db, ReturnData resultData) {
        if (publicUserInfo_list != null && publicUserInfo_list.size() != 0) {
            tutorial.lite_mod.human_res.TemplateUtilApi.pre_cmd_para_show_human_res_user_info(publicUserInfo_list, request, session, params2db, resultData);
        } else {
            return null;
        }
        return null;
    }

}
